<template>
	<view>
		<view class="content">
			<u-navbar :is-back="false" title="营销" :background="background"></u-navbar>
			<view class="tab-wrapper">
				<u-tabs-swiper ref="uTabs" :list="list" :current="current" @change="tabsChange" :is-scroll="false"
					swiperWidth="750" bg-color="transparent"></u-tabs-swiper>
			</view>
			<view class="status-wrapper boxShadow f-c-sa">
				<view :class="statusListIndex == index ? 'active' : ''" @click.stop="selectStatus(index)"
					v-for="(item, index) in shopList[current].statusList" v-key="index">
					{{ item.name }}
				</view>
			</view>
			<swiper :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish">
				<swiper-item class="swiper-item" v-for="(items, indexs) in shopList" :key="indexs">
					<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="onreachBottom">
						<u-empty v-if="!items.list.length" mode="data" style="height: 50vh;"></u-empty>
						<view class="item item1 f-c-sb" @click="goDetail('/marketing/coupons/detail', item)"
							v-if="current == 0" v-for="(item, index) in items.list" :key="index">
							<view class="left f-c-c">
								<view class="price">
									<span>￥</span>
									{{ item.money }}
								</view>
								<view class="remark">满{{ item.conditionMoney }}可用</view>
								<view class="btn" v-if="statusListIndex != 2" @click.stop="godata(item.id)">活动数据</view>
							</view>
							<view class="right">
								<view class="header">
									<view>{{ item.name }}</view>
									<span v-if="item.useTimeType == 1">
										有效期：{{ item.useTimeStart }}至{{ item.useTimeEnd }}
										<u-icon name="arrow-right" color="#666" size="18"></u-icon>
									</span>
									<span v-if="item.useTimeType == 2">
										有效期：{{ item.useTime == 0 ? '永久有效' : item.useTime + '天内可用' }}
										<u-icon name="arrow-right" color="#666" size="18"></u-icon>
									</span>
								</view>
								<view class="f-c-sb info">
									<view>{{ item.useStoresNum }}家门店可用</view>
									<view>
										用户实际已领取
										<span>{{ item.sendObtain }}</span>
										/{{ item.sendTotal }}
									</view>
								</view>
								<view class="bottom f-c-sb" v-if="statusListIndex == 0">
									<view v-if="items.operation" class="operation f-c-fs ">
										<view @click.stop="openMoudle('暂停优惠券', '确认要暂停优惠券吗？', 3, item.id, 1)">暂停</view>
										<!-- <view class="line"></view>
										<view>分享</view> -->
									</view>
									<view class="give" @click.stop="goselectClinet(item.id)">发放指定用户</view>
								</view>
								<view class="bottom f-c-sb" v-if="statusListIndex == 1">
									<view v-if="items.operation" class="operation f-c-fs ">
										<view @click.stop="openMoudle('删除优惠券', '确认要删除吗？删除之后无法恢复', 2, item.id, 2)">删除
										</view>
										<view class="line"></view>
										<view @click.stop="openMoudle('上架优惠券', '确认要上架优惠券吗？', 1, item.id, 1)">上架</view>
									</view>
								</view>

								<view class="bottom f-c-sb" v-if="statusListIndex == 2">
									<view v-if="items.operation" class="operation f-c-fs ">
										<view @click.stop="openMoudle('启用', '确认要启用优惠券吗', 1, item.id, 1)">启用</view>
										<view class="line"></view>
										<view @click.stop="openMoudle('下架', '确认要下架优惠券吗，下架之后无法恢复', 4, item.id, 1)">下架
										</view>
									</view>
								</view>
							</view>
							<view class="label">{{ item.typeStr }}</view>
						</view>
						<view class="item5 boxShadow" @click="goDetail('/marketing/peer/detail', item)"
							v-if="current == 3" v-for="(item, index) in items.list" :key="index">
							<view class="title">{{ item.peerTitle }}</view>
							<view class="time">
								活动时间：{{ item.timeStart }}至{{ item.timeEnd }}
								<u-icon name="arrow-right" color="#666" size="18" />
							</view>
							<view class="f-c-sb info">
								<view>{{ item.useStoresNum }}家门店</view>
								<view>参加人数：{{ item.inventedJoinNumber }}</view>
							</view>
							<view class="bottom f-c-sb" v-if="statusListIndex == 0">
								<view class="btn" @click.stop="godata(item.id)">活动数据</view>

								<view v-if="items.operation" class="operation f-c-fs ">
									<view @click.stop="openMoudle('暂停', '确认要暂停吗', 3, item.id, 1)">暂停</view>
									<!-- <view class="line"></view>
									<view>分享</view> -->
								</view>
							</view>
							<view class="bottom f-c-sb" v-if="statusListIndex == 2">
								<view class="btn" @click.stop="godata(item.id)">活动数据</view>

								<view v-if="items.operation" class="operation f-c-fs ">
									<view @click.stop="openMoudle('启用', '确认要启用活动到活动列表吗', 2, item.id, 1)">启用</view>
									<view class="line"></view>
									<view @click.stop="openMoudle('结束', '确认要结束活动吗，结束之后无法恢复', 4, item.id, 1)">结束</view>
								</view>
							</view>
							<view class="bottom f-c-sb" v-if="statusListIndex == 3">
								<view class="btn" @click.stop="godata(item.id)">活动数据</view>

								<view v-if="items.operation" class="operation" @click.stop="gocopy(item.id)">
									<u-icon name="file-text-fill" color="#177FFF" size="18"></u-icon>
									复制活动
								</view>
							</view>
							<view class="bottom f-c-sb" v-if="statusListIndex == 1">
								<view v-if="items.operation" class="operation" @click.stop="goedit(item.id)">
									<u-icon name="edit-pen" color="#177FFF" size="18"></u-icon>
									编辑
								</view>

								<view v-if="items.operation" class="operation f-c-fs ">
									<view @click.stop="openMoudle('删除', '确认要删除吗，删除之后无法恢复', 2, item.id, 2)">删除</view>
									<view class="line"></view>
									<view @click.stop="openMoudle('开始', '确认要开始活动到活动列表', 2, item.id, 1)">开始</view>
									<!-- 				<view class="line"></view>
                  <view @click.stop="openMoudle('下架', '确认要下架优惠券吗，下架之后无法恢复', 7)">分享</view> -->
								</view>
							</view>
						</view>
						<view class="item5 boxShadow" @click="goDetail('/marketing/setTheGuest/detail', item)"
							v-if="current == 1" v-for="(item, index) in items.list" :key="index">
							<view class="title">{{ item.collectName }}</view>
							<view class="time">
								活动时间：{{ item.timeStart }}至{{ item.timeEnd }}
								<u-icon name="arrow-right" color="#666" size="18" />
							</view>
							<view class="f-c-sb info">
								<view>{{ item.storeInfo }}</view>
								<view>报名情况：{{ item.inventedNumber }}/人</view>
							</view>
							<view class="bottom f-c-sb" v-if="statusListIndex == 0">
								<view class="btn" @click.stop="godata(item.id)">活动数据</view>

								<view v-if="items.operation" class="operation f-c-fs ">
									<view @click.stop="openMoudle('暂停', '确认要暂停活动吗', 3, item.id, 1)">暂停</view>
									<!-- <view class="line"></view>
                  <view>分享</view> -->
								</view>
							</view>
							<view v-if="statusListIndex == 3" class="bottom f-c-sb">
								<view class="btn" @click.stop="godata(item.id)">活动数据</view>

								<view v-if="items.operation" class="operation f-c-fs ">
									<view @click.stop="openMoudle('启用', '确认要启用活动到活动列表吗', 2, item.id, 1)">启用</view>
									<view class="line"></view>
									<view @click.stop="openMoudle('结束', '确认要结束活动吗，结束之后无法恢复', 4, item.id, 1)">结束</view>
								</view>
							</view>
							<view v-if="statusListIndex == 2" class="bottom f-c-sb">
								<view class="btn" @click.stop="godata(item.id)">活动数据</view>

								<view v-if="items.operation" class="operation" @click.stop="gocopy(item.id)">
									<u-icon name="file-text-fill" color="#177FFF" size="18"></u-icon>
									复制活动
								</view>
							</view>
							<view class="bottom f-c-sb" v-if="statusListIndex == 1">
								<view v-if="items.operation" class="operation" @click.stop="goedit(item.id)">
									<u-icon name="edit-pen" color="#177FFF" size="18"></u-icon>
									编辑
								</view>

								<view v-if="items.operation" class="operation f-c-fs ">
									<view @click.stop="openMoudle('删除', '确认要删除吗，删除之后无法恢复', 2, item.id, 2)">删除</view>
									<view class="line"></view>
									<view @click.stop="openMoudle('开始', '确认要开始活动到活动列表吗', 2, item.id, 1)">开始</view>
									<!-- 				<view class="line"></view>
                  <view @click.stop="openMoudle('下架', '确认要下架优惠券吗，下架之后无法恢复', 7)">分享</view> -->
								</view>
							</view>
						</view>
						<view class="item5 boxShadow" @click="goDetail('/marketing/seckill/detail', item)"
							v-if="current == 2" v-for="(item, index) in items.list" :key="index">
							<view class="title">{{ item.seckillName }}</view>
							<view class="time">
								活动时间：{{ item.timeStart }}至{{ item.timeEnd }}
								<u-icon name="arrow-right" color="#666" size="18" />
							</view>
							<view class="f-c-sb info">
								<view>{{ item.useStoresNum }}家门店</view>
								<view>已出售：{{ item.inventedSalesNumber }} 剩余：{{ item.rushBuyNumber }}</view>
							</view>
							<view class="bottom f-c-sb" v-if="statusListIndex == 0">
								<view class="btn" @click.stop="godata(item.id)">活动数据</view>

								<view v-if="items.operation" class="operation f-c-fs ">
									<view @click.stop="openMoudle('暂停', '确认要暂停吗', 3, item.id, 1)">暂停</view>
									<view class="line"></view>
									<!-- 									<view>分享</view>
									<view class="line"></view> -->
									<view>提成数据</view>
									<view class="line"></view>
									<view>分佣数据</view>
								</view>
							</view>
							<view class="bottom f-c-sb" v-if="statusListIndex == 2">
								<view class="btn" @click.stop="godata(item.id)">活动数据</view>

								<view v-if="items.operation" class="operation f-c-fs ">
									<view @click.stop="openMoudle('启用', '确认要启用活动到活动列表吗', 2, item.id, 1)">启用</view>
									<view class="line"></view>
									<view @click.stop="openMoudle('结束', '确认要结束活动吗，结束之后无法恢复', 4, item.id, 1)">结束</view>
									<view class="line"></view>
									<view>提成数据</view>
									<view class="line"></view>
									<view>分佣数据</view>
								</view>
							</view>
							<view class="bottom f-c-sb" v-if="statusListIndex == 3">
								<view class="btn" @click.stop="godata(item.id)">活动数据</view>

								<view v-if="items.operation" class="operation f-c-fs">
									<view @click.stop="gocopy(item.id)">
										<u-icon name="file-text-fill" color="#177FFF" size="18"></u-icon>
										复制活动
									</view>
									<view class="line"></view>
									<view>提成数据</view>
									<view class="line"></view>
									<view>分佣数据</view>
								</view>
							</view>
							<view class="bottom f-c-sb" v-if="statusListIndex == 1">
								<view v-if="items.operation" class="operation" @click.stop="goedit(item.id)">
									<u-icon name="edit-pen" color="#177FFF" size="18"></u-icon>
									编辑
								</view>

								<view v-if="items.operation" class="operation f-c-fs ">
									<view @click.stop="openMoudle('删除', '确认要删除吗？删除之后无法恢复', 2, item.id, 2)">删除</view>
									<view class="line"></view>
									<view @click.stop="openMoudle('开始', '确认要开始活动到活动列表吗', 2, item.id, 1)">开始</view>
								</view>
							</view>
						</view>
						<view class="item5 item6 boxShadow" @click="goDetail('/marketing/lottery/detail', item)"
							v-if="current == 4" v-for="(item, index) in items.list" :key="index">
							<view class="title">{{ item.luckdrawTitle }}</view>
							<view class="time" style="margin: 10rpx 0;">
								活动时间：{{ item.timeStart }}至{{ item.timeEnd }}
								<u-icon name="arrow-right" color="#666" size="18" />
							</view>
							<view class="f-c-sb info" style="margin: 30rpx 0;">
								<view>{{ item.useStoresNum }}家门店</view>
								<view v-if="statusListIndex != 1">参加人数：{{ item.inventedJoinNumber }}</view>
							</view>
							<view class="bottom f-c-sb" v-if="statusListIndex == 0">
								<view class="btn" @click.stop="godata(item.id)">活动数据</view>

								<view v-if="items.operation" class="operation f-c-fs ">
									<view @click.stop="openMoudle('暂停', '确认要暂停吗', 3, item.id, 1)">暂停</view>
									<!-- <view class="line"></view>
									<view>分享</view> -->
								</view>
							</view>
							<view class="bottom f-c-sb" v-if="statusListIndex == 2">
								<view class="btn" @click.stop="godata(item.id)">活动数据</view>

								<view v-if="items.operation" class="operation f-c-fs ">
									<view @click.stop="openMoudle('启用', '确认要开始活动到活动列表吗', 2, item.id, 1)">启用</view>
									<view class="line"></view>
									<view @click.stop="openMoudle('结束', '确认要结束活动吗，结束之后无法恢复', 4, item.id, 1)">结束</view>
								</view>
							</view>
							<view class="bottom f-c-sb" v-if="statusListIndex == 3">
								<view class="btn" @click.stop="godata(item.id)">活动数据</view>

								<view v-if="items.operation" class="operation" @click.stop="gocopy(item.id)">
									<u-icon name="file-text-fill" color="#177FFF" size="18"></u-icon>
									复制活动
								</view>
							</view>
							<view class="bottom f-c-sb" v-if="statusListIndex == 1">
								<view v-if="items.operation" class="operation" @click.stop="goedit(item.id)">
									<u-icon name="edit-pen" color="#177FFF" size="18"></u-icon>
									编辑
								</view>

								<view v-if="items.operation" class="operation f-c-fs ">
									<view @click.stop="openMoudle('删除', '确认要删除吗？删除之后无法恢复', 2, item.id, 2)">删除</view>
									<view class="line"></view>
									<view @click.stop="openMoudle('开始', '确认要开始活动到活动列表吗', 2, item.id, 1)">开始</view>
								</view>
							</view>
						</view>
						<view class="item5 item6 boxShadow" @click="goDetail('/marketing/equity/detail', item)"
							v-if="current == 5" v-for="(item, index) in items.list" :key="index">
							<view class="title">{{ item.rightsName }}</view>
							<view class="time" v-if="item.rightsTime != 0">
								有效期： {{ item.rightsTime }}天内有效
								<u-icon name="arrow-right" color="#666" size="18" />
							</view>
							<view class="time" v-if="item.rightsTime == 0">
								长期有效
								<u-icon name="arrow-right" color="#666" size="18" />
							</view>
							<view class="price">
								￥{{ item.rightsPrice }}
								<span>￥{{ item.rightsCost }}</span>
							</view>
							<view class="f-c-sb info">
								<view>{{ item.useStoresNum }}家门店</view>
								<view>已出售：{{ item.sellNumber }}</view>
							</view>
							<view class="bottom f-c-sb" v-if="statusListIndex == 0">
								<view class="btn" @click.stop="godata(item.id)">活动数据</view>

								<view v-if="items.operation" class="operation f-c-fs ">
									<view @click.stop="openMoudle('暂停', '确认要暂停吗', 3, item.id, 1)">暂停</view>
									<!-- <view class="line"></view>
									<view>分享</view> -->
								</view>
							</view>
							<view class="bottom f-c-sb" v-if="statusListIndex == 2">
								<view class="btn" @click.stop="godata(item.id)">活动数据</view>

								<view v-if="items.operation" class="operation f-c-fs ">
									<view @click.stop="openMoudle('启用', '确认要启用活动到活动列表吗', 1, item.id, 1)">启用</view>
									<view class="line"></view>
									<view @click.stop="openMoudle('结束', '确认要结束活动吗，结束之后无法恢复', 4, item.id, 1)">结束</view>
								</view>
							</view>
							<view class="bottom f-c-sb" v-if="statusListIndex == 3">
								<view class="btn" @click.stop="godata(item.id)">活动数据</view>

								<view v-if="items.operation" class="operation" @click.stop="gocopy(item.id)">
									<u-icon name="file-text-fill" color="#177FFF" size="18"></u-icon>
									复制活动
								</view>
							</view>
							<view class="bottom f-c-sb" v-if="statusListIndex == 1">
								<view v-if="items.operation" class="operation" @click.stop="goedit(item.id)">
									<u-icon name="edit-pen" color="#177FFF" size="18"></u-icon>
									编辑
								</view>

								<view v-if="items.operation" class="operation f-c-fs ">
									<view @click.stop="openMoudle('删除', '确认要删除吗？删除之后无法恢复', 2, item.id, 2)">删除</view>
									<view class="line"></view>
									<view @click.stop="openMoudle('开始', '确认要开始活动到活动列表吗', 1, item.id, 1)">开始</view>
								</view>
							</view>
						</view>
						<u-loadmore v-if="!items.listQuery.noData && items.list.length != 0" :status="'nomore'"
							:load-text="{ nomore: '没有更多数据了' }" />
						<u-loadmore v-if="items.listQuery.noData && items.list.length != 0" :status="'loading '" />
						<view style="height: 200rpx;width: 100%;"
							v-if="!items.listQuery.noData && items.list.length != 0"></view>
					</scroll-view>
				</swiper-item>
			</swiper>
		</view>
		<u-toast ref="uToast" />
		<view v-if="current == 0&&shopList[current].operation" class="create"
			@click.stop="goadd('/marketing/coupons/add')">
			创建优惠券
		</view>
		<view class="create" @click.stop="goadd('/marketing/setTheGuest/add')"
			v-if="current == 1&&shopList[current].operation">创建集客活动
		</view>
		<view class="create" @click.stop="goadd('/marketing/seckill/add')"
			v-if="current == 2&&shopList[current].operation">
			创建秒杀活动
		</view>
		<view class="create" @click.stop="goadd('/marketing/peer/add')"
			v-if="current == 3&&shopList[current].operation">
			创建同行活动
		</view>
		<view class="create" @click.stop="goadd('/marketing/lottery/add')"
			v-if="current == 4&&shopList[current].operation">
			创建抽奖活动
		</view>
		<view class="create" @click.stop="goadd('/marketing/equity/add')"
			v-if="current == 5&&shopList[current].operation">
			创建权益卡
		</view>
		<u-modal ref="uModal" v-model="modalObj.show" :show-cancel-button="true" :show-title="modalObj.showTitle"
			@confirm="confirm" :content="modalObj.content"></u-modal>
	</view>
</template>

<script>
	import {
		collectList,
		collectUpdateStatus,
		couponList,
		couponUpdateStatus,
		luckdrawList,
		luckdrawUpdateStatus,
		peerList,
		peerUpdateStatus,
		rightsList,
		rightsUpdateStatus,
		seckillList,
		seckillUpdateStatus
	} from '../../api/marketing';
	import {
		mapGetters
	} from 'vuex';

	export default {
		data() {
			return {
				background: {
					background: 'url('+this.$imagePath+'glxcx/-e-00背景.png) no-repeat',
					backgroundSize: 'cover'
				},
				list: [{
						name: '优惠券',
						value: '1',
						type: 'status'
					},
					{
						name: '集客活动',
						value: '2',
						type: 'status'
					},
					{
						name: '秒杀活动',
						value: '3',
						type: 'delFlag'
					},
					{
						name: '同行活动',
						value: '4',
						type: 'delFlag'
					},
					{
						name: '抽奖活动',
						value: '5',
						type: 'delFlag'
					},
					{
						name: '权益卡',
						value: '6',
						type: 'delFlag'
					}
				],

				current: 0, // tabs组件的current值，表示当前活动的tab选项
				swiperCurrent: 0, // swiper组件的current值，表示当前那个swiper-item是活动的
				statusListIndex: 0,
				modalObj: {
					show: false,
					showTitle: '温馨提示',
					content: '',
					type: ''
				},
				shopList: [{
						statusListIndex: 0,
						operation: true,
						listQuery: {
							pageNo: 1,
							pageSize: 20,
							noData: true
						},
						statusList: [{
								name: '已上架',
								value: '1'
							},
							{
								name: '未上架',
								value: '2'
							},
							{
								name: '暂停中',
								value: '3'
							},
							{
								name: '已下架',
								value: '4'
							}
						],
						list: []
					},
					{
						statusListIndex: 0,
						operation: true,

						listQuery: {
							pageNo: 1,
							pageSize: 20,
							noData: true
						},
						statusList: [{
								name: '进行中',
								value: '2'
							},
							{
								name: '未开始',
								value: '1'
							},
							{
								name: '已结束',
								value: '4'
							},
							{
								name: '暂停',
								value: '3'
							}
						],
						list: []
					},
					{
						statusListIndex: 0,
						operation: true,

						listQuery: {
							pageNo: 1,
							pageSize: 20,
							noData: true
						},
						statusList: [{
								name: '进行中',
								value: '2'
							},
							{
								name: '未开始',
								value: '1'
							},
							{
								name: '暂停中',
								value: '3'
							},
							{
								name: '已结束',
								value: '4'
							}
						],
						list: []
					},
					{
						statusListIndex: 0,
						operation: true,

						listQuery: {
							pageNo: 1,
							pageSize: 20,
							noData: true
						},
						statusList: [{
								name: '进行中',
								value: '2'
							},
							{
								name: '未开始',
								value: '1'
							},
							{
								name: '暂停中',
								value: '3'
							},
							{
								name: '已下架',
								value: '4'
							}
						],
						list: []
					},
					{
						statusListIndex: 0,
						operation: true,

						listQuery: {
							pageNo: 1,
							pageSize: 20,
							noData: true
						},
						statusList: [{
								name: '进行中',
								value: '2'
							},
							{
								name: '未开始',
								value: '1'
							},
							{
								name: '暂停中',
								value: '3'
							},
							{
								name: '已结束',
								value: '4'
							}
						],
						list: []
					},
					{
						statusListIndex: 0,
						operation: true,

						listQuery: {
							pageNo: 1,
							pageSize: 20,
							noData: true
						},
						statusList: [{
								name: '进行中',
								value: '1'
							},
							{
								name: '未开始',
								value: '2'
							},
							{
								name: '暂停中',
								value: '3'
							},
							{
								name: '已结束',
								value: '4'
							}
						],
						list: []
					}
				]
			};
		},
		computed: {
			...mapGetters(['userInfo'])
		},
		onLoad() {
			this.init();
		},
		onShow() {

			if (this.$get('isCreatStatus') == 1) {
				this.statusListIndex = 1;

				this.shopList[this.current].listQuery.pageNo = 1;
				this.init();
				this.$remove('isCreatStatus');
			}
			this.operationFN()


		},
		onPullDownRefresh() {
			console.log('refresh');
			this.shopList[this.current].listQuery.pageNo = 1;
			this.init();
			setTimeout(function() {
				uni.stopPullDownRefresh();
			}, 1000);
		},
		methods: {
			// tabs通知swiper切换
			tabsChange(index) {
				this.swiperCurrent = index;
			},
			operationFN() {
				console.log(this.userInfo)
				if (this.userInfo.couponSwitch == 1 || (this.userInfo.modulePermissions && this.userInfo.modulePermissions
						.indexOf('67') != -1)) {
					this.shopList[0].operation = true
				} else {
					this.shopList[0].operation = false
				}
				if (this.userInfo.seckillSwitch == 1 || (this.userInfo.modulePermissions && this.userInfo.modulePermissions
						.indexOf('69') != -1)) {
					this.shopList[2].operation = true
				} else {
					this.shopList[2].operation = false
				}
				if (this.userInfo.collectSwitch == 1 || (this.userInfo.modulePermissions && this.userInfo.modulePermissions
						.indexOf('68') != -1)) {
					this.shopList[1].operation = true
				} else {
					this.shopList[1].operation = false

				}
				if (this.userInfo.peerSwitch == 1 || (this.userInfo.modulePermissions && this.userInfo.modulePermissions
						.indexOf('70') != -1)) {
					this.shopList[3].operation = true
				} else {
					this.shopList[3].operation = false

				}
				if (this.userInfo.luckdrawSwitch == 1 || (this.userInfo.modulePermissions && this.userInfo
						.modulePermissions.indexOf('71') != -1)) {
					this.shopList[4].operation = true
				} else {
					this.shopList[4].operation = false

				}
				if (this.userInfo.rightsSwitch == 1 || (this.userInfo.modulePermissions && this.userInfo.modulePermissions
						.indexOf('72') != -1)) {
					this.shopList[5].operation = true
				} else {
					this.shopList[5].operation = false
				}
				this.$forceUpdate()
			},
			// swiper-item左右移动，通知tabs的滑块跟随移动
			transition(e) {
				let dx = e.detail.dx;
				this.$refs.uTabs.setDx(dx);
			},
			// 由于swiper的内部机制问题，快速切换swiper不会触发dx的连续变化，需要在结束时重置状态
			// swiper滑动结束，分别设置tabs和swiper的状态
			animationfinish(e) {
				let current = e.detail.current;
				this.$refs.uTabs.setFinishCurrent(current);
				this.swiperCurrent = current;
				this.current = current;
				if (this.statusListIndex != this.shopList[current].statusListIndex) {
					this.statusListIndex = this.shopList[current].statusListIndex;
				}
				if (this.shopList[current].list.length == 0 && this.shopList[current].listQuery.noData) {
					this.getlist();
				}
			},
			// scroll-view到底部加载更多
			onreachBottom() {
				if (this.shopList[this.current].listQuery.noData) {
					this.getlist();
				}
			},
			selectStatus(index) {
				if (index != this.shopList[this.current].statusListIndex) {
					this.statusListIndex = index;
					this.shopList[this.current].statusListIndex = index;
					this.shopList[this.current].listQuery.noData = true;
					this.shopList[this.current].listQuery.pageNo = 1;
					this.getlist();
				}
			},
			checkStatus() {
				var current = this.current;
				var userInfo = this.userInfo;

				if (current == 0 && userInfo.couponSwitch != 1) {
					this.$refs.uToast.show({
						title: '暂无操作权限',
						type: 'error'
					});
					return false;
				} else if (current == 1 && userInfo.collectSwitch != 1) {
					this.$refs.uToast.show({
						title: '暂无操作权限',
						type: 'error'
					});
					return false;
				} else if (current == 2 && userInfo.seckillSwitch != 1) {
					this.$refs.uToast.show({
						title: '暂无操作权限',
						type: 'error'
					});
					return false;
				} else if (current == 3 && userInfo.peerSwitch != 1) {
					this.$refs.uToast.show({
						title: '暂无操作权限',
						type: 'error'
					});
				} else if (current == 4 && userInfo.luckdrawSwitch != 1) {
					this.$refs.uToast.show({
						title: '暂无操作权限',
						type: 'error'
					});
					return false;
				} else if (current == 5 && userInfo.rightsSwitch != 1) {
					this.$u.toast('暂无操作权限');
					return false;
				} else {
					return true
				}

			},
			openMoudle(title, content, status, id, type) {
				console.log(this.checkStatus())
				if (!this.checkStatus()) {
					return;
				}
				this.modalObj.title = title;
				this.modalObj.content = content;
				this.modalObj.show = true;
				this.modalObj.type = type;
				this.modalObj.id = id;
				this.modalObj.status = status;
			},
			init() {
				this.getlist();
			},
			confirm() {
				this.updateStatus();
			},
			updateStatus() {
				var current = this.current;
				var data = {};
				if (this.modalObj.type == 1) {
					data.status = this.modalObj.status;
				} else if (this.modalObj.type == 2) {
					data.delFlag = this.modalObj.status;
				}
				if (current == 0) {
					data.id = this.modalObj.id;
					this.couponUpdateStatusFn(data);
				} else if (current == 1) {
					data.id = this.modalObj.id;
					this.collectUpdateStatusFn(data);
				} else if (current == 2) {
					data.seckillId = this.modalObj.id;
					this.seckillUpdateStatusFn(data);
				} else if (current == 3) {
					data.id = this.modalObj.id;
					this.peerUpdateStatusFn(data)
				} else if (current == 4) {
					data.luckdrawId = this.modalObj.id;
					this.luckdrawUpdateStatusFn(data);
				} else if (current == 5) {
					data.rightsId = this.modalObj.id;
					this.rightsUpdateStatusFn(data);
				}
			},
			couponUpdateStatusFn(data) {
				couponUpdateStatus(data).then(res => {
					if (res.code == 1) {
						this.shopList[this.current].listQuery.noData = true;
						this.shopList[this.current].listQuery.pageNo = 1;
						this.getlist();
					} else {
						uni.showToast({
							title: res.msg,
							icon: 'none'
						});
					}
				});
			},
			peerUpdateStatusFn(data) {
				peerUpdateStatus(data).then(res => {
					if (res.code == 1) {
						this.shopList[this.current].listQuery.noData = true;
						this.shopList[this.current].listQuery.pageNo = 1;
						this.getlist();
					} else {
						uni.showToast({
							title: res.msg,
							icon: 'none'
						});
					}
				});
			},
			collectUpdateStatusFn(data) {
				collectUpdateStatus(data).then(res => {
					if (res.code == 1) {
						this.shopList[this.current].listQuery.noData = true;
						this.shopList[this.current].listQuery.pageNo = 1;
						this.getlist();
					} else {
						uni.showToast({
							title: res.msg,
							icon: 'none'
						});
					}
				});
			},
			seckillUpdateStatusFn(data) {
				seckillUpdateStatus(data).then(res => {
					if (res.code == 1) {
						this.shopList[this.current].listQuery.noData = true;
						this.shopList[this.current].listQuery.pageNo = 1;
						this.getlist();
					} else {
						uni.showToast({
							title: res.msg,
							icon: 'none'
						});
					}
				});
			},
			rightsUpdateStatusFn(data) {
				rightsUpdateStatus(data).then(res => {
					if (res.code == 1) {
						this.shopList[this.current].listQuery.noData = true;
						this.shopList[this.current].listQuery.pageNo = 1;
						this.getlist();
					} else {
						uni.showToast({
							title: res.msg,
							icon: 'none'
						});
					}
				});
			},
			luckdrawUpdateStatusFn(data) {
				luckdrawUpdateStatus(data).then(res => {
					if (res.code == 1) {
						this.shopList[this.current].listQuery.noData = true;
						this.shopList[this.current].listQuery.pageNo = 1;
						this.getlist();
					} else {
						uni.showToast({
							title: res.msg,
							icon: 'none'
						});
					}
				});
			},
			getlist() {
				var current = this.current;
				if (current == 0) {
					this.getCouponList();
				} else if (current == 1) {
					this.getCollectList();
				} else if (current == 2) {
					this.getSeckillList();
				} else if (current == 3) {
					this.getPeerList()
				} else if (current == 4) {
					this.getLuckdrawList();
				} else if (current == 5) {
					this.getRightsList();
				}
			},
			godata(id) {
				if (!this.checkStatus()) {
					return;
				}
				var current = this.current;
				if (current == 0) {
					this.$navigateTo('/marketing/coupons/statistics', {
						id
					});
				} else if (current == 1) {
					this.$navigateTo('/marketing/setTheGuest/statistics', {
						id
					});
				} else if (current == 2) {
					this.$navigateTo('/marketing/seckill/statistics', {
						id
					});
				} else if (current == 3) {
					this.$navigateTo('/marketing/peer/statistics', {
						id
					});
				} else if (current == 4) {
					this.$navigateTo('/marketing/lottery/statistics', {
						id
					});
				} else if (current == 5) {
					this.$navigateTo('/marketing/equity/statistics', {
						id
					});
				}
			},
			goedit(id) {
				if (!this.checkStatus()) {
					return;
				}
				var current = this.current;
				if (current == 0) {
					this.$navigateTo('/marketing/coupons/edit', {
						id
					});
				} else if (current == 1) {
					this.$navigateTo('/marketing/setTheGuest/edit', {
						id
					});
				} else if (current == 2) {
					this.$navigateTo('/marketing/seckill/edit', {
						id
					});
				} else if (current == 3) {
					this.$navigateTo('/marketing/peer/edit', {
						id
					});
				} else if (current == 4) {
					this.$navigateTo('/marketing/lottery/edit', {
						id
					});
				} else if (current == 5) {
					this.$navigateTo('/marketing/equity/edit', {
						id
					});
				}
			},
			getCouponList() {
				var data = {
					storeBasicId: this.userInfo.storeBasicId,
					status: this.shopList[this.current].statusList[this.statusListIndex].value,
					...this.shopList[this.current].listQuery
				};
				couponList(data).then(res => {
					console.log(res);
					if (this.shopList[this.current].listQuery.pageNo == 1) {
						this.shopList[this.current].list = res.data;
					} else {
						this.shopList[this.current].list = this.shopList[this.current].list.concat(res.data);
					}
					this.shopList[this.current].listQuery.pageNo += 1;
					if (this.shopList[this.current].listQuery.pageSize != res.data.length) {
						this.shopList[this.current].listQuery.noData = false;
					}
				});
			},
			getPeerList() {
				var data = {
					storeBasicId: this.userInfo.storeBasicId,
					status: this.shopList[this.current].statusList[this.statusListIndex].value,
					...this.shopList[this.current].listQuery
				};
				peerList(data).then(res => {
					console.log(res);
					if (this.shopList[this.current].listQuery.pageNo == 1) {
						this.shopList[this.current].list = res.data;
					} else {
						this.shopList[this.current].list = this.shopList[this.current].list.concat(res.data);
					}
					this.shopList[this.current].listQuery.pageNo += 1;
					if (this.shopList[this.current].listQuery.pageSize != res.data.length) {
						this.shopList[this.current].listQuery.noData = false;
					}
				});
			},
			getCollectList() {
				var data = {
					storeBasicId: this.userInfo.storeBasicId,
					status: this.shopList[this.current].statusList[this.statusListIndex].value,
					...this.shopList[this.current].listQuery
				};
				collectList(data).then(res => {
					console.log(res);
					if (this.shopList[this.current].listQuery.pageNo == 1) {
						this.shopList[this.current].list = res.data;
					} else {
						this.shopList[this.current].list = this.shopList[this.current].list.concat(res.data);
					}
					this.shopList[this.current].listQuery.pageNo += 1;
					if (this.shopList[this.current].listQuery.pageSize != res.data.length) {
						this.shopList[this.current].listQuery.noData = false;
					}
				});
			},
			getRightsList() {
				var data = {
					storeBasicId: this.userInfo.storeBasicId,
					status: this.shopList[this.current].statusList[this.statusListIndex].value,
					...this.shopList[this.current].listQuery
				};
				rightsList(data).then(res => {
					console.log(res);
					if (this.shopList[this.current].listQuery.pageNo == 1) {
						this.shopList[this.current].list = res.data;
					} else {
						this.shopList[this.current].list = this.shopList[this.current].list.concat(res.data);
					}
					this.shopList[this.current].listQuery.pageNo += 1;
					if (this.shopList[this.current].listQuery.pageSize != res.data.length) {
						this.shopList[this.current].listQuery.noData = false;
					}
				});
			},
			getLuckdrawList() {
				var data = {
					storeBasicId: this.userInfo.storeBasicId,
					status: this.shopList[this.current].statusList[this.statusListIndex].value,
					...this.shopList[this.current].listQuery
				};
				luckdrawList(data).then(res => {
					console.log(res);
					if (this.shopList[this.current].listQuery.pageNo == 1) {
						this.shopList[this.current].list = res.data;
					} else {
						this.shopList[this.current].list = this.shopList[this.current].list.concat(res.data);
					}
					this.shopList[this.current].listQuery.pageNo += 1;
					if (this.shopList[this.current].listQuery.pageSize != res.data.length) {
						this.shopList[this.current].listQuery.noData = false;
					}
				});
			},
			getSeckillList() {
				var data = {
					storeBasicId: this.userInfo.storeBasicId,
					status: this.shopList[this.current].statusList[this.statusListIndex].value,
					...this.shopList[this.current].listQuery
				};
				seckillList(data).then(res => {
					console.log(res);
					if (this.shopList[this.current].listQuery.pageNo == 1) {
						this.shopList[this.current].list = res.data;
					} else {
						this.shopList[this.current].list = this.shopList[this.current].list.concat(res.data);
					}
					this.shopList[this.current].listQuery.pageNo += 1;
					if (this.shopList[this.current].listQuery.pageSize != res.data.length) {
						this.shopList[this.current].listQuery.noData = false;
					}
				});
			},
			goadd(url) {
				if (!this.checkStatus()) {
					return;
				}
				this.$navigateTo(url, {});
			},
			gocopy(id) {
				if (!this.checkStatus()) {
					return;
				}
				var current = this.current;
				if (current == 0) {
					this.$navigateTo('/marketing/coupons/add', {
						id
					});
				} else if (current == 1) {
					this.$navigateTo('/marketing/setTheGuest/add', {
						id
					});
				} else if (current == 2) {
					this.$navigateTo('/marketing/seckill/add', {
						id
					});
				} else if (current == 3) {
					this.$navigateTo('/marketing/peer/add', {
						id
					});
				} else if (current == 4) {
					this.$navigateTo('/marketing/lottery/add', {
						id
					});
				} else if (current == 5) {
					this.$navigateTo('/marketing/equity/add', {
						id
					});
				}
			},
			goDetail(url, item) {
				this.$navigateTo(url, item);
			},
			goselectClinet(id) {
				this.$navigateTo('../seletClient/seletClient', {
					id: id,
					type: 1
				});
			}
		}
	};
</script>

<style lang="less" scoped>
	.content {
		width: 100%;
		background: #f5f5f5;

		swiper {
			flex: 1;
			height: 69vh;

			swiper-item {
				height: 100%;
			}
		}

		.tab-wrapper {
			width: 100%;
		}

		.status-wrapper {
			width: 660rpx;
			height: 78rpx;
			background: #ffffff;
			border-radius: 8rpx;
			margin: 40rpx auto 20rpx;
			font-size: 22rpx;
			font-weight: 500;
			color: #333333;

			view {
				width: 25%;
				height: 100%;
				text-align: center;
				line-height: 78rpx;
			}

			.active {
				color: #177fff;
			}
		}

		.item5 {
			width: 703rpx;
			height: 234rpx;
			background: #ffffff;
			border-radius: 20rpx;
			padding: 10rpx 40rpx;
			margin: 20rpx auto;

			&.item6 {
				height: 268rpx;

				.info {
					margin: 15rpx 0;
					font-size: 20rpx;
					font-weight: 500;
					color: #666666;
				}

				.price {
					font-size: 24rpx;
					font-weight: 700;
					color: #ff6738;
					line-height: 40rpx;

					span {
						margin-left: 10rpx;
						font-size: 20rpx;
						font-weight: 500;
						color: #999999;
						text-decoration: line-through;
					}
				}
			}

			.title {
				width: 500rpx;
				height: 45rpx;
				font-size: 24rpx;
				font-weight: 700;
				text-align: left;
				color: #333333;
				line-height: 45rpx;
				overflow: hidden;
				text-overflow: ellipsis;
				white-space: nowrap;
			}

			.time {
				font-size: 20rpx;
				font-weight: 500;
				color: #666666;
			}

			.info {
				margin: 20rpx 0;
				font-size: 20rpx;
				font-weight: 500;
				color: #666666;
			}

			.bottom {
				border-top: 1px solid #ebebeb;
				padding-top: 13rpx;

				.btn {
					width: 122rpx;
					height: 42rpx;
					border: 1px solid #333333;
					border-radius: 22rpx;
					font-size: 22rpx;
					font-weight: bold;
					text-align: center;
					line-height: 41rpx;
				}

				.operation {
					font-size: 22rpx;
					font-weight: bold;
					color: #333333;

					button {
						width: auto;
						height: auto;
						margin: 0;
						padding: 0;
						background-color: transparent;
						font-size: 22rpx;
						font-weight: bold;
						color: #333333;
						border: none;
					}

					.line {
						width: 2rpx;
						height: 34rpx;
						background: #dfdfdf;
						margin: 0 20rpx;
					}
				}
			}
		}

		.item1 {
			width: 740rpx;
			height: 268rpx;
			background-image: url('https://sj.shopec.com.cn/image-server/glxcx/marketing-listbg.png');
			background-size: cover;
			background-repeat: no-repeat;
			margin: 0 auto;
			position: relative;

			.left {
				width: 213rpx;
				height: 231rpx;
				padding: 30rpx 0;
				box-sizing: border-box;
				flex-wrap: wrap;
				color: #333333;
				position: absolute;
				left: 20rpx;
				top: 20rpx;

				.price {
					width: 100%;
					font-size: 60rpx;
					font-weight: bold;
					text-align: center;

					span {
						font-size: 21rpx;
						font-weight: bold;
						text-align: center;
					}
				}

				.remark {
					width: 100%;
					font-size: 21rpx;
					font-weight: bold;
					text-align: center;
				}

				.btn {
					width: 122rpx;
					height: 42rpx;
					border: 1px solid #333333;
					border-radius: 22rpx;
					font-size: 22rpx;
					font-weight: bold;
					text-align: center;
					line-height: 41rpx;
				}
			}

			.label {
				width: 111rpx;
				height: 41rpx;
				background: #fed441;
				border-radius: 0px 0px 20rpx 20rpx;
				font-size: 22rpx;
				font-weight: 700;
				text-align: center;
				color: #333333;
				position: absolute;
				top: 20rpx;
				right: 64rpx;
			}

			.right {
				width: 490rpx;
				height: 231rpx;
				padding: 30rpx;
				box-sizing: border-box;
				position: absolute;
				right: 20rpx;
				top: 20rpx;

				.header {
					font-size: 21rpx;
					font-weight: bold;
					color: #333333;

					span {
						font-size: 16rpx;
						font-weight: 500;
						color: #666666;
					}
				}

				.info {
					margin: 25rpx 0;
					font-size: 20rpx;
					font-weight: 500;
					color: #666666;

					span {
						color: #177fff;
					}
				}

				.bottom {
					.operation {
						font-size: 24rpx;
						font-weight: bold;
						color: #333333;

						button {
							width: auto;
							height: auto;
							margin: 0;
							padding: 0;
							background-color: transparent;
							font-size: 24rpx;
							font-weight: bold;
							color: #333333;
							border: none;
						}

						.line {
							width: 2rpx;
							height: 34rpx;
							background: #dfdfdf;
							margin: 0 20rpx;
						}
					}

					.give {
						font-size: 22rpx;
						font-weight: bold;
						color: #177fff;
					}
				}
			}
		}
	}

	.create {
		width: 710rpx;
		height: 100rpx;
		background: #177fff;
		border-radius: 13rpx;
		font-size: 32rpx;
		font-weight: bold;
		color: #ffffff;
		text-align: center;
		line-height: 100rpx;
		margin: 0 auto;
		position: fixed;
		bottom: 50rpx;
		left: 20rpx;
	}
</style>
